const app = getApp();
const server = require('../../utils/server');
const common = require("../../utils/common")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    menus: [
    { tit: '服务大厅', desc: '功能反馈',url: '/pages/index/complaint' },    
    ],  
    list: []
  },

  onLoad() {
    this.getProject()
    common.checkLogin(app)
  },

  getProject() {
    if (this.data.isLoading) return
    this.setData({ isLoading: true })
    server.postJSON(common.basePath + 'feedback/getproject', {     
      count: 10
    }, res => {
      this.setData({ isLoading: false })      
      const { errno, data, errmsg } = res.data;
      if (errno == '0') {
        this.setData({list: data})
      } 
    })
  },

  onReady() {
    this.authLogin = this.selectComponent('#authLogin')
  },


  navHandle(e) {
    const { url } = e.currentTarget.dataset
    console.log(url)
    common.navigateTo({ url })
  },


  openCustomerServiceChat() {
    wx.openCustomerServiceChat({
      extInfo: { url: 'https://work.weixin.qq.com/kfid/kfc36d45e31c439a293' },
      corpId: 'wx62cf9cd0b9b3fb1b'
    })
  }
})